\section{backsub --- solution of linear equations}
\label{fn:backsub}
\index{backsub()}
\index{linear equation solver}
\index{solution of linear equations}
\begin{rail}
backsub : 'backsub' '(' List ',' Matrix ')' ;
\end{rail}


The \verb+backsub+ function computes the solution to the set of
linear equations described by:

\[ A  X = B \]

The list argument to \verb+backsub+ is the result from
\verb+factor(A)+. The second argument to \verb+backsub+ is
the matrix $B$, where each column of B is a seperate right hand side.

\verb+backsub+ returns $X$, the solution of the linear equations. Each
column of $X$ corresponds to that column of $B$.


\paragraph{Example}
\index{example of backsub()}
\index{backsub()!example}
\begin{verbatim}
> A = rand(4,4)
 A =
    0.493      0.161      0.137      0.879  
    0.782     0.0642      0.446      0.761  
    0.591      0.271      0.367      0.852  
   0.0721     0.0384      0.949      0.107  
> X1 = rand(4,1)
 X1 =
    0.812  
    0.543  
    0.254  
   0.0825  
> B1 = A*X1
 B1 =
    0.595  
    0.846  
    0.791  
    0.329  
> X2 = rand(4,1)
 X2 =
    0.697  
    0.137  
    0.815  
    0.974  
> B2 = A*X2
 B2 =
     1.33  
     1.66  
     1.58  
    0.933  
> B = [B1,B2]
 B =
    0.595       1.33  
    0.846       1.66  
    0.791       1.58  
    0.329      0.933  
> F = factor(A)
   lu           pvt          rcond        
> backsub(F,B)
    0.812      0.697  
    0.543      0.137  
    0.254      0.815  
   0.0825      0.974  
> // This is [X1,X2] - so it works!
\end{verbatim}

See also: Page~\pageref{fn:factor} \verb+factor()+,
Page~\pageref{fn:inv} \verb+inv()+,
Page~\pageref{fn:solve} \verb+solve()+.

\newpage





